package com.wj.rspmproperty.mapper;

import com.github.pagehelper.Page;
import com.wj.rspmproperty.pojo.Room;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author WeiJin
 * @version 1.0
 */

public interface RoomMapper {
    /**
     * 根据id查询房间信息
     * @param id 房间编号
     * @return 房间信息
     */
    @Select("select * from room where room_id = #{id}")
    Room getRoomById(Integer id);

    /**
     * 根据楼层信息查询房间
     * @param floorId
     * @return
     */
    @Select("select room_id , room_code from room where room_floor_id = #{floorId}")
    List<Room> roomOfFloor(Integer floorId);

    /**
     * 批量添加房间
     * @param list
     * @return
     */
    int insertRooms(List<Room> list);

    /**
     * 分页查询房间
     * @param map
     * @return
     */
    @Results(id = "baseWithBuildingName")
    Page<Room> pageOfRooms(Map<String, String> map);

    /**
     * 批量修改房间状态
     * @param ids
     * @param status
     * @return
     */
    Integer changeRoomStatus(List<Integer> ids, Integer status);
}
